function debounce(fn, delay) {
    const timer = null;
    return function () {
        clearTimeout(timer);
        timer = setTimeout(() => {
            fn();
        }, delay)
    }
}